<?
    // bit shifting test
    header("Content-type: text/plain");
    
    $permissions = array(
        "NOT_LOGGED_IN" => 0x10,
        "GUESTS" => 0x08,
        "STUDENTS" => 0x04,
        "LANDLORDS" => 0x02,
        "ALL_LOGGED_IN" => 0x01,
    );
    
    for ($x = 0; $x < 32; $x++) {
        $allowed = array();
        foreach ($permissions as $name=>$permnum) {
            if ($x & $permnum) $allowed[] = $name;
        }
        echo "Permissions for $x:\n";
        print_r($allowed);
        echo "\n\n";
    }
    
?>